#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<cmath>
#include<string.h>
using namespace std; 
//char Up[]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char Up[]={'B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A'};
//char Low[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char Low[]={'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','a'};

int main()
{   
  char s[90];
  int n;
  while( gets(s) ){     
  n=atoi(s);
  for(int i=0;i<n;i++){
    gets(s);
    for(int j=0;j<strlen(s);j++)
      if( s[j]>='A'&&s[j]<='Z' )  s[j]=Up[ s[j]-'A' ];
      else if( s[j]>='a'&&s[j]<='z' )  s[j]=Low[ s[j]-'a' ];
      else continue;
    cout<<s<<endl;
  }         
  }  
  //system("pause");  
  return 0;
}
